import request from "@/utils/request";

const COINS_BASE_URL = "/merchant/coupon/pageOrder";

const couponApi = {
  getPage(params?: object) {
    return request({
      url: `${COINS_BASE_URL}`,
      method: "get",
      params,
    });
  },
  audit(data: object) {
    return request({
      url: `/merchant/coupon/audit`,
      method: "post",
      data,
    });
  },
  getOrder(id: number) {
    return request({
      url: `/merchant/coupon/getOrderById`,
      method: "get",
      params: {
        id: id,
      },
    });
  },
  putAchievement(data: object) {
    return request({
      url: "/merchant/coupon/uploadAchievement",
      method: "post",
      data,
    });
  },
  // 新增代金券
  addStorage(data: object) {
    return request({
      url: "/api/v1/couponStorage/apply",
      method: "post",
      data,
    });
  },
  // 代金券库存列表
  couponStorageList(data: object) {
    return request({
      url: `/api/v1/couponStorage/page`,
      method: "post",
      data,
    });
  },
  // 代金券开关
  couponEnable(data: object) {
    return request({
      url: `/api/v1/couponStorage/enable`,
      method: "post",
      data,
    });
  },

  //获取代金券兑换记录
  getCouponList(data: object) {
    return request({
      url: `/api/v1/coupon/page`,
      method: "post",
      data,
    });
  },

  getBrandList(id: number) {
    return request({
      url: `/api/v1/company/${id}/brandList`,
      method: "post",
    });
  },
};

export default couponApi;

export interface ConsumerHouseCouponForm {
  id: number;
  houseId: number;
  couponStorageId: number;
  status: number;
  couponCode: string;
}
